package cn.edu.ptu.jobfairs.basic.common;

import lombok.Data;

/**
 * Created by Lin Chenxiao on 2020-03-05
 **/
@Data
public class Result {
    private int errCode = 0;
    private String errMsg = "";
    private String traceId;
    public static Result OK = new Result();

    public static Result ok() {
        return new Result();
    }

    public static Result fail(Errors errors) {
        Result result = new Result();
        result.errCode = errors.getCode();
        result.errMsg = errors.getMessage();
        return result;
    }

    public static Result fail(Errors errors, String message) {
        Result result = new Result();
        result.errCode = errors.getCode();
        result.errMsg = message;
        return result;
    }
}
